package com.bayi.storage.base

import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.bayi.storage.model.StorageCabinetModel
import okhttp3.internal.notify
import okhttp3.internal.notifyAll

/**
 * @author Administrator on 2024-05-31.
 * <p>
 * 站在顶峰 看世界
 * 落到谷底 思人生
 */
open class BaseViewModel(application: Application) : AndroidViewModel(application) {

    protected var _tipMsg = MutableLiveData<String>()
    var mTipMsg: LiveData<String> = _tipMsg

    var localModelLive: MutableLiveData<StorageCabinetModel> = MutableLiveData()

    init {
        localModelLive.value = BaseApplication.getApp().getStorageCabinetModel()
    }

    fun onSaveData() {
        BaseApplication.getApp().setStorageCabinetModel(localModelLive.value)
        localModelLive.value = BaseApplication.getApp().getStorageCabinetModel()
        _tipMsg.value = "保存成功"
    }
}